package cj.web.admin.dao;
/*
 *  
 *  
*/
import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.ReturnGeneratedKeys;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.admin.domain.AuditStepLog;

/**
 * 
 * @author 
 *
 */
@DAO
public interface AuditStepLogDAO{
	
	@SQL("SELECT * FROM AuditStepLog WHERE deleteFlag=1 AND newsId=:t.newsId ORDER BY updateAt DESC LIMIT :t.start,:t.length ")
    List<AuditStepLog> query(@SQLParam("t") AuditStepLog auditStepLog);
	
	@SQL("SELECT count(*) FROM AuditStepLog WHERE deleteFlag=1 AND newsId=:t.newsId ")
    int querySize(@SQLParam("t") AuditStepLog auditStepLog);
    
    @SQL("select * from AuditStepLog where id=:1")
    AuditStepLog queryById(int id);
    
    @SQL("select * from AuditStepLog where newsId=:1")
    List<AuditStepLog> queryByNewsId(int newsId);
    
    @ReturnGeneratedKeys
    @SQL("INSERT INTO AuditStepLog (id,newsId,name,stepBegin,stepEnd,userId,isAgree,memo,descs,deleteFlag,createUser,createAt,updateUser,updateAt) VALUES (:t.id,:t.newsId,:t.name,:t.stepBegin,:t.stepEnd,:t.userId,:t.isAgree,:t.memo,:t.descs,1,:t.createUser,now(),:t.updateUser,now())")
    public int create(@SQLParam("t") AuditStepLog auditStepLog);
	
    @SQL("UPDATE AuditStepLog SET deleteFlag=0 WHERE id=:1")
    void deleteById(int id);
}